package com.kitom.qqmap.bean.geocode;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 地理/逆地理编码服务响应对象
 * @author <a href="https://gitee.com/kitom">ki_tom</a>
 * @since 2019-12-27
 */
@NoArgsConstructor
@Data
public class QQmapGeocodeGeoResult implements Serializable {

    private static final long serialVersionUID = -5872252292442519223L;

    /**
     * 状态码，0为正常，其它为异常，详细请参阅状态码说明
     */
    private Integer status;
    private String message;
    /**
     * 本次请求的唯一标识
     */
    private String request_id;
    /**
     * 逆地址解析结果
     */
    private Result result;

    @NoArgsConstructor
    @Data
    public static class Result {
        private Location location;
        private String address;
        private FormattedAddresses formatted_addresses;
        /*
         * 地址部件，address不满足需求时可自行拼接
         */
        private AddressComponent address_component;
        /*
         *行政区划信息
         */
        private AdInfo ad_info;
        /*
         * 坐标相对位置参考
         */
        private AddressReference address_reference;
        /*
         * 	查询的周边poi的总数，仅在传入参数get_poi=1时返回
         */
        private Integer poi_count;
        /*
         * 周边地点（POI）数组
         */
        private List<Pois> pois;

        @NoArgsConstructor
        @Data
        public static class Location {
            private Double lat;
            private Double lng;
        }

        @NoArgsConstructor
        @Data
        public static class FormattedAddresses {
            private String recommend;
            private String rough;
        }

        @NoArgsConstructor
        @Data
        public static class AddressComponent {
            private String nation;
            private String province;
            private String city;
            private String district;
            private String street;
            private String street_number;
        }

        @NoArgsConstructor
        @Data
        public static class AdInfo {
            private String nation_code;
            private String adcode;
            private String city_code;
            private String name;
            private Location location;
            private String nation;
            private String province;
            private String city;
            private String district;

            @NoArgsConstructor
            @Data
            public static class Location {
                private String lat;
                private String lng;
            }
        }

        @NoArgsConstructor
        @Data
        public static class AddressReference {
            private BusinessArea business_area;
            private FamousArea famous_area;
            private Crossroad crossroad;
            private Town town;
            private StreetNumber street_number;
            private Street street;
            private LandmarkL2 landmark_l2;

            @NoArgsConstructor
            @Data
            public static class BusinessArea {
                private String id;
                private String title;
                private Location location;
                private Integer _distance;
                private String _dir_desc;

                @NoArgsConstructor
                @Data
                public static class Location {
                    private Double lat;
                    private Double lng;
                }
            }

            @NoArgsConstructor
            @Data
            public static class FamousArea {
                private String id;
                private String title;
                private Location location;
                private Integer _distance;
                private String _dir_desc;

                @NoArgsConstructor
                @Data
                public static class Location {
                    private Double lat;
                    private Double lng;
                }
            }

            @NoArgsConstructor
            @Data
            public static class Crossroad {
                private String id;
                private String title;
                private Location location;
                private Double _distance;
                private String _dir_desc;

                @NoArgsConstructor
                @Data
                public static class Location {
                    private Double lat;
                    private Double lng;
                }
            }

            @NoArgsConstructor
            @Data
            public static class Town {
                private String id;
                private String title;
                private Location location;
                private Integer _distance;
                private String _dir_desc;

                @NoArgsConstructor
                @Data
                public static class Location {
                    private Double lat;
                    private Double lng;
                }
            }

            @NoArgsConstructor
            @Data
            public static class StreetNumber {
                private String id;
                private String title;
                private Location location;
                private Double _distance;
                private String _dir_desc;

                @NoArgsConstructor
                @Data
                public static class Location {
                    private Double lat;
                    private Double lng;
                }
            }

            @NoArgsConstructor
            @Data
            public static class Street {
                private String id;
                private String title;
                private Location location;
                private Double _distance;
                private String _dir_desc;

                @NoArgsConstructor
                @Data
                public static class Location {
                    private Double lat;
                    private Double lng;
                }
            }

            @NoArgsConstructor
            @Data
            public static class LandmarkL2 {
                private String id;
                private String title;
                private Location location;
                private Integer _distance;
                private String _dir_desc;

                @NoArgsConstructor
                @Data
                public static class Location {
                    private Double lat;
                    private Double lng;
                }
            }
        }

        @NoArgsConstructor
        @Data
        public static class Pois {
            private String id;
            private String title;
            private String address;
            private String category;
            private Location location;
            private AdInfo ad_info;
            private Integer _distance;
            private String _dir_desc;

            @NoArgsConstructor
            @Data
            public static class Location {
                private Double lat;
                private Double lng;
            }

            @NoArgsConstructor
            @Data
            public static class AdInfo {
                private String adcode;
                private String province;
                private String city;
                private String district;
            }
        }
    }
}
